import request from "../utils/request";

// 轮播列表请求接口
export const bannerIndex = (data?: any) => {
  return new Promise(resolve => {
    request({
      //请求轮播列表
      url: "/pcapi/banner/index", // url
      params: data
    }).then(res => {
      // 成功回调
      resolve(res);
    });
  });
};

// 图片上传请求接口
export const imageUpload = (data?: any) => {
  console.log(data);

  return new Promise(resolve => {
    request({
      //请求图片上传
      method: "post",
      url: "/pcapi/index/upload", // url
      data: data
    }).then(res => {
      // 成功回调
      resolve(res);
    });
  });
};

// 轮播添加请求接口
export const bannerAdd = (data?: any) => {
  return new Promise(resolve => {
    request({
      url: "/pcapi/banner/add", // url
      params: data
    }).then(res => {
      // 成功回调
      resolve(res);
    });
  });
};
// 确认编辑轮播请求接口
export const bannerEdits = (data?: any) => {
  return new Promise(resolve => {
    request({
      url: "/pcapi/banner/update", // url
      params: data
    }).then(res => {
      // 成功回调
      resolve(res);
    });
  });
};
// 轮播删除请求接口
export const bannerDeletes = (data?: any) => {
  return new Promise(resolve => {
    request({
      url: "/pcapi/banner/del", // url
      params: data
    }).then(res => {
      // 成功回调
      resolve(res);
    });
  });
};
// 商品列表请求接口
export const goodsList = (data?: any) => {
  return new Promise(resolve => {
    request({
      //请求商品列表
      url: "/pcapi/goods/index", // url
      params: data
    }).then(res => {
      // 成功回调
      resolve(res);
    });
  });
};
